<template>
  <div class="dashboard">
    <div>
      <img class="decoration lt" src="./icon/l.png" alt="" />
      <img class="decoration lb" src="./icon/l.png" alt="" />
      <img class="decoration rt" src="./icon/r.png" alt="" />
      <img class="decoration rb" src="./icon/r.png" alt="" />
    </div>
    <div class="content">
      <h1>{{ siteName }}</h1>
      <div class="cards">
        <div
          class="card"
          v-for="(item, k) in system"
          :key="k"
          @click="goToSystem(k)"
        >
          <div class="text">
            <h2>{{ item.title }}</h2>
            <div class="tip">{{ item.english.toLocaleUpperCase() }}</div>
          </div>
          <img class="icon" :src="item.icon" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
import Config from "@/config/app.js";
export default {
  data() {
    return {
      siteName: Config.siteName
    };
  },
  computed: {
    ...mapState("adminSystem", ["system"])
  },
  methods: {
    goToSystem(k) {
      this.$store.dispatch("adminSystem/initSubsystem", k);
    }
  },
  created: function() {}
};
</script>
<style lang="scss">
.dashboard {
  width: 100%;
  height: 100vh;
  background: linear-gradient(180deg, #131e2d 0%, #2a3b4c 100%);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  .content {
    width: 1200px;
    overflow: hidden;
    text-align: center;
    h1 {
      font-family: serif;
      text-align: center;
      color: #fffcda;
      display: inline-block;
      margin-bottom: 18px;
      font-size: 36px;
      position: relative;
      &:before {
        display: block;
        content: "";
        width: 69px;
        height: 26px;
        position: absolute;
        top: 8px;
        left: -90px;
        background-image: url("./icon/h1.png");
        background-size: 100% 100%;
      }
      &:after {
        display: block;
        content: "";
        width: 69px;
        height: 26px;
        position: absolute;
        top: 8px;
        right: -90px;
        background-image: url("./icon/h1.png");
        transform: scaleX(-1);
        background-size: 100% 100%;
      }
    }
    .cards {
      width: 100%;
      display: flex;
      overflow: hidden;
      flex-wrap: wrap;
      justify-content: space-between;
      .card {
        width: 364px;
        height: 130px;
        border: 1px solid rgba(229, 229, 229, 1);
        border-radius: 8px;
        margin: 25px 0;
        cursor: pointer;
        background-color: #fff;
        display: flex;
        padding: 20px 30px;
        align-items: center;
        .text {
          flex: 1;
          display: flex;
          height: 100%;
          flex-direction: column;
          justify-content: space-between;
          align-items: flex-start;
          h2 {
            color: #191d3b;
            font-size: 24px;
          }
          .tip {
            color: #191d3b;
            text-align: left;
            font-size: 16px;
          }
        }
        .icon {
          width: 76px;
          height: 73px;
        }
      }
    }
  }
  .decoration {
    position: fixed;
    &.lt {
      width: 126px;
      top: 114px;
      left: 48px;
      height: 62px;
    }
    &.lb {
      width: 126px;
      bottom: 9px;
      left: 11px;
      height: 62px;
    }
    &.rt {
      width: 62px;
      top: 3px;
      right: 50px;
      height: 126px;
    }
    &.rb {
      width: 62px;
      bottom: 28px;
      right: 53px;
      height: 126px;
    }
  }
}
</style>
